﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace CommunityToolkitMvvmDemo.ValidationRules
{
    public class ValueValidationRule : ValidationRule
    {
        public string Value { get; set; }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            var strVal = (string)value;
            if (string.IsNullOrWhiteSpace(strVal) || string.IsNullOrEmpty(strVal)) return new ValidationResult(false, "值能不空");
   
            if ( strVal == Value) return new ValidationResult(false, "输入的值不能是11");

            return new ValidationResult(true, null);
        }
    }
}
